<?php
/**
 * jishupu-cms
 * @Author:技术铺<jishupu@qq.com>
 * @Date: 2021/11/11
 */

namespace App\Http\Resources;

/**
 * 管理员角色模块资源
 * Class UserRoleResource
 * @package App\Http\Resources
 */
class UserRoleResource extends BaseResource
{
    /**
     * @param \Illuminate\Http\Request $request
     * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
     */
    public function toArray($request)
    {
        return $this->filterFields([
            'id' => $this->id,
            'name' => $this->name,
            'username' => $this->username,
            'description' => $this->description,
            'phone_number' => $this->phone_number,
            'email' => $this->email,
            'last_login_time' => $this->last_login_time,
            'login_fail_times' => $this->login_fail_times,
            'status' => $this->status,
            'created_at' => $this->created_at ? $this->created_at->format('Y-m-d H:i:s') : "",
            'updated_at' => $this->updated_at ? $this->updated_at->format('Y-m-d H:i:s') : "",
        ]);
    }
}
